Skip to content

Migrate os.path to pathlib.Path in file_processor_handler.py#68758

Merged
potiuk merged 1 commit into
apache:mainfrom
Dotify71:fix/68757-pathlib-migration
Jul 3, 2026
Merged

Migrate os.path to pathlib.Path in file_processor_handler.py#68758
potiuk merged 1 commit into
apache:mainfrom
Dotify71:fix/68757-pathlib-migration

Conversation

@Dotify71

Copy link
Copy Markdown
Contributor

Description

Fixes #68757

The airflow.utils.log.file_processor_handler module currently relies heavily on the os.path library for filesystem path manipulations. To modernize the codebase, improve cross-platform readability, and align with modern Python standards, this PR migrates os.path calls (e.g., os.path.join, os.path.abspath, os.path.isdir) to their pathlib.Path equivalents where possible.

Testing

  • Existing Airflow unit tests will cover these pathways as this handler is central to DAG parsing logging.

@pierrejeambrun pierrejeambrun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall, just one comment though

Comment thread airflow-core/src/airflow/utils/log/file_processor_handler.py Outdated
@Dotify71 Dotify71 force-pushed the fix/68757-pathlib-migration branch 5 times, most recently from fedc00f to f642c56 Compare June 27, 2026 17:15
Comment thread scripts/in_container/run_migration_reference.py Outdated

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed unrelated changes.

@Dotify71 Dotify71 force-pushed the fix/68757-pathlib-migration branch from a40c67b to 764e55b Compare June 29, 2026 16:23
@Dotify71

Copy link
Copy Markdown
Contributor Author

Thanks @potiuk for the review!

I have:

  1. Dropped the unrelated Alembic patch commit.
  2. Fixed the failing static checks (removed the unused import os in file_processor_handler.py and changed .resolve() to .absolute() to match the original os.path.abspath behavior, which doesn't resolve symlinks and was breaking tests).

This is now a clean 1-commit PR. Let me know if anything else is needed!

@Dotify71 Dotify71 force-pushed the fix/68757-pathlib-migration branch from 764e55b to a1f40cc Compare June 29, 2026 16:24
@Dotify71 Dotify71 force-pushed the fix/68757-pathlib-migration branch 3 times, most recently from 9b0939f to 932e8f7 Compare June 30, 2026 17:41
@Dotify71 Dotify71 changed the title Refactor: Migrate os.path to pathlib.Path in file_processor_handler.py Migrate os.path to pathlib.Path in file_processor_handler.py Jun 30, 2026
@Dotify71 Dotify71 force-pushed the fix/68757-pathlib-migration branch from 932e8f7 to e20b952 Compare July 2, 2026 09:14
@Dotify71 Dotify71 force-pushed the fix/68757-pathlib-migration branch from e20b952 to 300fee0 Compare July 2, 2026 11:19
@Dotify71

Dotify71 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Hey @potiuk as all the things are correct now can you give a quick review

@Dotify71 Dotify71 requested a review from potiuk July 2, 2026 11:51

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unrelated run_migration_reference.py change is gone — the diff is now a
clean pathlib migration of file_processor_handler.py, and CI is green. Thanks
for splitting it out. LGTM.


This review was drafted by an AI-assisted tool and confirmed by an Airflow
maintainer. The maintainer approving this PR has read the findings and signed
off. If something feels off, please reply on the PR and a maintainer will
follow up.

More on how Airflow handles maintainer review:
contributing-docs/05_pull_requests.rst.

@potiuk potiuk merged commit ffd8d4e into apache:main Jul 3, 2026
93 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API area:logging area:task-sdk ready for maintainer review Set after triaging when all criteria pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor: Migrate os.path to pathlib.Path in file_processor_handler.py

3 participants